package jwebtester.business.utils;

import javax.faces.application.FacesMessage;
import javax.faces.application.FacesMessage.Severity;
import javax.faces.context.FacesContext;

public class FacesHelper {
	public void info(final String summary, final String detail) {
		addMessage(FacesMessage.SEVERITY_INFO, summary, detail);
	}

	public void error(final String summary, final String detail) {
		addMessage(FacesMessage.SEVERITY_ERROR, summary, detail);
	}

	private void addMessage(final Severity severity, final String summary, final String detail) {
		final FacesContext context = FacesContext.getCurrentInstance();
		final FacesMessage message = new FacesMessage(severity, summary, detail);
		context.addMessage(null, message);
	}
}
